<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="{{CDN}}/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="{{CDN}}/easyui/themes/icon.css">
		<script type="text/javascript" src="{{CDN}}/easyui/jquery.min.js"></script>
		<script type="text/javascript" src="{{CDN}}/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="{{CDN}}/easyui/locale/easyui-lang-zh_CN.js"></script>
		<script>

		$(function(){
					
			/*表格初始化*/
			$("#grid").datagrid({
				singleSelect:false,
				fit:true,
				//fitColumns:true,
				collapsible:true, 
				striped:true,
				rownumbers:true, 
			    columns:[[    
			    	{field:'CK',checkbox:true},
			        {field:'company_name',title:'企业名称',width:300,align:'left'},
			        {field:'is_del',title:'是否删除',width:40,align:'left'},
			        {field:'social_credit',title:'统一社会信用码',width:200,align:'left'}, 
			        {field:'entry_sign',title:'是否入川',width:100,align:'center'},
			        {field:'province',title:'省份',width:100,align:'center'}, 
			        {field:'city',title:'地区',width:100,align:'left'}, 
			        {field:'legal_person',title:'法人',width:80,align:'center'},    
			        {field:'company_type',title:'注册类型',width:230,align:'left'},
			        {field:'registered_capital',title:'注册资本',width:100,align:'right'},
			        {field:'registered_date',title:'注册时间',width:100,align:'right'},
			        {field:'lxr',title:'联系人',width:150,align:'left'},
			        {field:'data_source_code',title:'数据来源',width:200,align:'left'},
			        {field:'registered_address',title:'注册地址',width:500,align:'left'},
			        {field:'business_address',title:'经营地址',width:500,align:'left'}
			    ]],
			    pagination:true,
			    pageSize:27,
			    pageList:[10,27,50,100,200,500]
			});
			
			/* 查询下拉框加载数据  */
			//
			$('#search_data_source').combobox({    
			    url:'/common/dict/getComboboxDataSourceDict',    
			    valueField:'code',
			    width:300,
			    textField:'name',
			    filter: function(q, row){
					var opts = $(this).combobox('options');
					return row[opts.textField].indexOf(q) >= 0;
				}
			});

			$('#search_data_source').combobox('setValue','sichuan')
			
			function query(){
				$("#grid").datagrid({
					url:'/middleLib/companyMain/getcompanyMainList',
					method:"POST",
					queryParams: parent.getFormJson($("#search_form"))
				});
			}
			
			//查询按钮
			$("#search_btn").click(query);
			//query();
			

			
			//打开链接
			$("#open_url_btn").click(function(){
				var rows = $('#grid').datagrid('getSelections');
				if(rows.length<1){
					$.messager.alert('提示','请勾选一条');
					return false;
				}
				var url = rows[0].url;
				window.open(url);
			});


			// delete_one_all
			$("#delete_one_all").click(function(){
				var rows = $('#grid').datagrid('getSelections');
				if(rows.length<1){
					$.messager.alert('提示','请勾选一条');
					return false;
				}

				var data_source = parent.getFormJson($("#search_form")).data_source
				var company_name_list = rows[0].company_name
				for(var i= 1 ;i<rows.length;i++){
					company_name_list = company_name_list + "^"+rows[i].company_name
				}
				$.post("/middleLib/companyMain/deleteAllByCompanyId",{company_name_list:company_name_list,data_source:data_source},function(response){
					$.messager.alert('提示',JSON.stringify(response));
					query();
				})
			});
		});
		</script>
	</head>
	<body class="easyui-layout">
		
		<!-- 主表格 -->
		<div region="center" border="false">
			<div id ="toolbar">
				<!-- 查询条件表单 -->
				<form id ="search_form" method="post" class="easyui-form">
					<table width="100%">
						<tr>
							<td align="right" width="15%">企业名称:</td>
							<td width="15%"  align="left" >
								<input class="easyui-textbox"  name="company_name" style="width:400px"  />
							</td>

							<td align="right" width="15%">数据来源:</td>
							<td width="5%"  align="left">
								<input  class="easyui-combobox" id = "search_data_source"  panelHeight='auto' name="data_source" style="width:200px" />
							</td>

							<td align="right" width="15%">entry_sign:</td>
							<td width="15%"  align="left">
								<select  class="easyui-combobox"  panelHeight='auto' name="entry_sign" style="width:200px" >
									<option>all</option>
									<option>0</option>
									<option>1</option>
									<option>2</option>
								</select>
							</td>
							<td align="right" width="15%">省份:</td>
							<td width="15%"  align="left">
								<input  class="easyui-textbox"  name="province" style="width:200px" />
							</td>
							<td width="5%" ></td>
						</tr>
					</table>
				</form>
				<a href="#" id="search_btn" class="easyui-linkbutton"	 data-options="iconCls:'icon-search'"  >查询</a>
				<a href="#" id='open_url_btn' class="easyui-linkbutton" data-options="iconCls:'icon-reload'">打开链接页面</a>
				<a href="#" id='delete_one_all' class="easyui-linkbutton" data-options="iconCls:'icon-reload'">删除相关企业人员资质</a>
			</div>

			<table id="grid" data-options="toolbar:'#toolbar'" />

		</div>
	</body>
</html>
